﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using RubricaSentimentale.Model;

namespace RubricaSentimentale
{
	public partial class Infos : UserControl
	{
        public static readonly DependencyProperty Detail=DependencyProperty.RegisterAttached("Detail", typeof(bool), typeof(Infos), new PropertyMetadata(false));
        public bool DetailView {
            get { return (bool)GetValue(Detail); }
            set {
                SetValue(Detail, value);
                Reverse = false;
            }
        }

        public event EventHandler change;
		
		public bool Reverse{
			get;set;
		}

        private FormattedList<object> list=new FormattedList<object>();
        public FormattedList<object> Dettagli {
            get { return list; }
            set {
                list = value;
            }
        }
		public Infos()
		{
			// Required to initialize variables
			InitializeComponent();
            Dettagli = list;
            
		}

        public void Change()
        {
            if (change != null)
                change(this, null);
        }

		private void btnFilms_Tap(object sender, System.Windows.Input.GestureEventArgs e)
		{
            (DataContext as Persona).Films.GetFormatted(tbxDetails.Inlines);
            DetailView = true;
            Change();
		}

        private void btnFood_Tap(object sender, GestureEventArgs e)
        {
            (DataContext as Persona).Food.GetFormatted(tbxDetails.Inlines);
            DetailView = true;
            Change();
        }

        private void btnDate_Tap(object sender, GestureEventArgs e)
        {
            (DataContext as Persona).Date.GetFormatted(tbxDetails.Inlines);
            DetailView = true;
            Change();
        }

        private void btnText_Tap(object sender, GestureEventArgs e)
        {
            tbxDetails.Text = (string)(DataContext as Persona).Note;
            DetailView = true;
            Change();
        }


        public double getHeight()
        {
            return tbxDetails.ActualHeight;
        }
        
	}
}